<?php /* Smarty version 2.6.26, created on 2011-12-05 15:14:10
         compiled from vinahost/viewticket.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'cycle', 'vinahost/viewticket.tpl', 290, false),)), $this); ?>
<script type="text/javascript" src="../includes/jscript/jquerylq.js"></script>

<script language="javascript">
var ticketid = '<?php echo $this->_tpl_vars['ticketid']; ?>
';
var pagefilename = '<?php echo $_SERVER['PHP_SELF']; ?>
';
var ticketcontent = "";
<?php echo '
function doDeleteReply(id) {
    if (confirm("Are you sure you want to delete this support ticket reply?")) {
        window.location=pagefilename+\'?action=viewticket&id=\'+ticketid+\'&sub=del&idsd=\'+id;
    }
}
function doDeleteTicket() {
    if (confirm("Are you sure you want to delete this support ticket and all replies?")) {
        window.location=pagefilename+\'?sub=deleteticket&id=\'+ticketid;
    }
}
function doDeleteNote(id) {
    if (confirm("Are you sure you want to delete this support ticket note?")) {
        window.location=pagefilename+\'?action=viewticket&id=\'+ticketid+\'&sub=delnote&idsd=\'+id;
    }
}
function quoteTicket(id,ids) {
    $(".tab").removeClass("tabselected");
    $("#tab0").addClass("tabselected");
    $(".tabbox").hide();
    $("#tab0box").show();
    $.post("supporttickets.php", { action: "getquotedtext", id: id, ids: ids },
    function(data){
        $("#replymessage").val(data+"\\n\\n"+$("#replymessage").val());
    });
    return false;
}

$(document).ready(function(){

$(".tabbox").css("display","none");
$(".tab").click(function(){
    var elid = $(this).attr("id");
    $(".tab").removeClass("tabselected");
    $("#"+elid).addClass("tabselected");
    $(".tabbox").slideUp();
    $("#"+elid+"box").slideDown();
    $("#tab").val(elid.substr(3));
});
$(".editbutton").click(function () {
    var butid = $(this).attr("id");
    ticketcontent = $("#"+butid+"_box").html();
    var browsername = navigator.appName;
    if (browsername == "Microsoft Internet Explorer") {
        var ticketcontentpassback = ticketcontent.replace(/<br>/gi, \'\\n\');
    } else {
        var ticketcontentpassback = ticketcontent.replace(/<br>/gi, \'\');
    }
    $("#"+butid+"_box").html("<textarea rows=\\"10\\" style=\\"width:99%\\" id=\\""+butid+"_box_text\\">"+ticketcontentpassback+"</textarea>");
    $(".editticketbuttons").toggle();
});
$(".savebutton").click(function () {
    var butid = $(this).attr("id");
    var newticketcontent = $("#"+butid+"_box_text").val();
    var ticketcontentpassback = newticketcontent.replace(/\\n/gi, \'<br>\');
    $("#"+butid+"_box").html(ticketcontentpassback);
    $.post("supporttickets.php", { action: "updatereply", text: newticketcontent, id: butid });
    $(".editticketbuttons").toggle();
});
$(".cancelbutton").click(function () {
    var butid = $(this).attr("id");
    $("#"+butid+"_box").html(ticketcontent);
    $(".editticketbuttons").toggle();
});
$("#replymessage").focus(function () {
    $.post("supporttickets.php", { action: "makingreply", id: ticketid });
});
$(window).unload( function () {
    $.post("supporttickets.php", { action: "endreply", id: ticketid });
});
$("#insertpredef").click(function () {
    $("#prerepliescontainer").slideToggle();
    return false;
});
$(".loadpredefinedreplycat").livequery("click", function(event) {
    var catid = $(this).attr("id");
    $.post("supporttickets.php", { action: "loadpredefinedreplies", cat: catid },
    function(data){
        $("#prerepliescontent").html(data);
    });
    return false;
});
$(".selectpredefinedreply").livequery("click", function(event) {
    var artid = $(this).attr("id");
    $.post("supporttickets.php", { action: "getpredefinedreply", id: artid },
    function(data){
        $(\'#replymessage\').addToReply(data);
    });
    $("#prerepliescontainer").slideToggle();
    return false;
});
$("#addfileupload").click(function () {
    $("#fileuploads").append("<input type=\\"file\\" name=\\"attachments[]\\" size=\\"85\\"><br />");
    return false;
});
$("#ticketstatus").change(function () {
    $.post("supporttickets.php", { action: "changestatus", id: ticketid, status: this.options[this.selectedIndex].text });
});

});
'; ?>

</script>

<?php echo $this->_tpl_vars['infobox']; ?>


<?php if ($this->_tpl_vars['replyingadmin']): ?><div class="errorbox"><?php echo $this->_tpl_vars['replyingadmin']['name']; ?>
 viewed this ticket and started making a reply @ <?php echo $this->_tpl_vars['replyingadmin']['time']; ?>
</div><?php endif; ?>

<h2 style="margin:0;">#<?php echo $this->_tpl_vars['tid']; ?>
 - <?php echo $this->_tpl_vars['subject']; ?>
</h2>

<p>Client: <?php if ($this->_tpl_vars['userid']): ?><a href="clientssummary.php?userid=<?php echo $this->_tpl_vars['userid']; ?>
"<?php if ($this->_tpl_vars['clientgroupcolour']): ?> style="background-color:<?php echo $this->_tpl_vars['clientgroupcolour']; ?>
"<?php endif; ?> target="_blank"><?php echo $this->_tpl_vars['clientname']; ?>
</a><?php else: ?>Not a Registered Client<?php endif; ?> | Last Reply: <?php echo $this->_tpl_vars['lastreply']; ?>
</p>

<div id="tabs">
    <div style="float:right">Set Status: <select name="ticketstatus" id="ticketstatus" style="font-weight:bold">
    <?php $_from = $this->_tpl_vars['statuses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['statusitem']):
?>
    <option<?php if ($this->_tpl_vars['statusitem']['title'] == $this->_tpl_vars['status']): ?> selected<?php endif; ?> style="color:<?php echo $this->_tpl_vars['statusitem']['color']; ?>
"><?php echo $this->_tpl_vars['statusitem']['title']; ?>
</option>
    <?php endforeach; endif; unset($_from); ?>
    </select>
    </div>
    <ul>
        <li id="tab0" class="tab"><a href="javascript:;">Reply</a></li>
        <li id="tab1" class="tab"><a href="javascript:;">Notes<?php if ($this->_tpl_vars['numnotes']): ?> (<?php echo $this->_tpl_vars['numnotes']; ?>
)<?php endif; ?></a></li>
        <li id="tab2" class="tab"><a href="javascript:;">Custom Fields</a></li>
        <li id="tab3" class="tab"><a href="javascript:;">Options</a></li>
        <li id="tab4" class="tab"><a href="javascript:;">Log</a></li>
    </ul>
</div>
<div id="tab0box" class="tabbox">
    <div id="tab_content">

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>
?action=viewticket&id=<?php echo $this->_tpl_vars['ticketid']; ?>
" enctype="multipart/form-data" name="replyfrm">

<textarea name="message" id="replymessage" rows="14" style="width:100%"><?php echo $this->_tpl_vars['predefinedmessage']; ?>



<?php echo $this->_tpl_vars['signature']; ?>
</textarea>

<br /><img src="images/spacer.gif" height="8" width="1" /><br />

<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td width="15%" class="fieldlabel">Post Reply</td><td class="fieldarea"><select name="postaction">
<option value="return">Set to Answered & Return to Ticket List
<option value="answered">Set to Answered & Remain in Ticket View
<?php $_from = $this->_tpl_vars['statuses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['statusitem']):
?>
<?php if ($this->_tpl_vars['statusitem']['id'] > 4): ?><option value="setstatus<?php echo $this->_tpl_vars['statusitem']['id']; ?>
">Set to <?php echo $this->_tpl_vars['statusitem']['title']; ?>
 & Remain in Ticket View</option><?php endif; ?>
<?php endforeach; endif; unset($_from); ?>
<option value="close">Close & Return to Ticket List
<option value="note">Add as a Private Ticket Note
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#" onClick="window.open('supportticketskbarticle.php','kbartwnd','width=500,height=400,scrollbars=yes');return false">Insert KB Article Link</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#" id="insertpredef">Insert Predefined Ticket Reply</a>
</td></tr>
<tr><td class="fieldlabel">Attachments</td><td class="fieldarea"><input type="file" name="attachments[]" size="85"> <a href="#" id="addfileupload"><img src="images/icons/add.png" align="absmiddle" border="0" /> Add More</a><br /><div id="fileuploads"></div></td></tr>
<?php if ($this->_tpl_vars['userid']): ?><tr><td class="fieldlabel">Add Billing Entry</td><td class="fieldarea"><input type="text" name="billingdescription" size="60" value="To invoice, enter a description" onfocus="if(this.value=='To invoice, enter a description')this.value=''" /> @ <input type="text" name="billingamount" size="10" value="Amount" /> <select name="billingaction">
<option value="3" /> Invoice Immediately</option>
<option value="0" /> Don't Invoice for Now</option>
<option value="1" /> Invoice on Next Cron Run</option>
<option value="2" /> Add to User's Next Invoice</option>
</select></td></tr><?php endif; ?>
</table>

<div id="prerepliescontainer" style="display:none;">
    <img src="images/spacer.gif" height="8" width="1" />
    <br />
    <div id="prerepliescontent" style="border:1px solid #DFDCCE;background-color:#F7F7F2;padding:5px;text-align:left;">
        <?php echo $this->_tpl_vars['predefinedreplies']; ?>

    </div>
</div>

<img src="images/spacer.gif" height="8" width="1" />
<br />
<div align="center"><input type="submit" value="Add Response" name="postreply" class="button" /></div>

</form>

    </div>
</div>
<div id="tab1box" class="tabbox">
    <div id="tab_content">

<?php if (! $this->_tpl_vars['numnotes']): ?>
<div align="center">No Notes Found for this Ticket</div>
<?php else: ?>
<table width="100%" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<?php $_from = $this->_tpl_vars['notes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['note']):
?>
<tr><td rowspan="2" bgcolor="#F8F8F8" width="120" valign="top" align="left"><?php echo $this->_tpl_vars['note']['admin']; ?>
<br><a href="#" onClick="doDeleteNote('<?php echo $this->_tpl_vars['note']['id']; ?>
');return false"><img src="images/delete.gif" alt="Delete Ticket Note" border="0" align="absmiddle"></a></td><td bgcolor="#F8F8F8" align="left"><?php echo $this->_tpl_vars['note']['date']; ?>
</td></tr><tr><td bgcolor="#F8F8F8" align="left"><?php echo $this->_tpl_vars['note']['message']; ?>
</td></tr>
<?php endforeach; endif; unset($_from); ?>
</table>
<?php endif; ?>

    </div>
</div>
<div id="tab2box" class="tabbox">
    <div id="tab_content">

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>
?action=viewticket&id=<?php echo $this->_tpl_vars['ticketid']; ?>
&sub=savecustomfields">

<?php if (! $this->_tpl_vars['numcustomfields']): ?>
<div align="center">No Custom Fields Setup for this Department</div>
<?php else: ?>
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<?php $_from = $this->_tpl_vars['customfields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['customfield']):
?>
<tr><td width="25%" class="fieldlabel"><?php echo $this->_tpl_vars['customfield']['name']; ?>
</td><td class="fieldarea"><?php echo $this->_tpl_vars['customfield']['input']; ?>
</td></tr>
<?php endforeach; endif; unset($_from); ?>
</table>
<img src="images/spacer.gif" height="10" width="1" /><br />
<div align="center"><input type="submit" value="Save Changes" class="button"></div>
</form>
<?php endif; ?>

    </div>
</div>
<div id="tab3box" class="tabbox">
    <div id="tab_content">

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>
?action=viewticket&id=<?php echo $this->_tpl_vars['ticketid']; ?>
">

<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td width="15%" class="fieldlabel">Department</td><td class="fieldarea"><select name="deptid">
<?php $_from = $this->_tpl_vars['departments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['department']):
?>
<option value="<?php echo $this->_tpl_vars['department']['id']; ?>
"<?php if ($this->_tpl_vars['department']['id'] == $this->_tpl_vars['deptid']): ?> selected<?php endif; ?>><?php echo $this->_tpl_vars['department']['name']; ?>
</option>
<?php endforeach; endif; unset($_from); ?>
</select></td><td width="15%" class="fieldlabel">Client ID</td><td class="fieldarea"><input type="text" name="userid" size="10" value="<?php echo $this->_tpl_vars['userid']; ?>
" /></td></tr>
<tr><td class="fieldlabel">Subject</td><td class="fieldarea"><input type="text" name="subject" value="<?php echo $this->_tpl_vars['subject']; ?>
" style="width:80%"></td><td class="fieldlabel">Flag</td><td class="fieldarea"><select name="flagto">
<option value="0">None</option>
<?php $_from = $this->_tpl_vars['staff']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['staffmember']):
?>
<option value="<?php echo $this->_tpl_vars['staffmember']['id']; ?>
"<?php if ($this->_tpl_vars['staffmember']['id'] == $this->_tpl_vars['flag']): ?> selected<?php endif; ?>><?php echo $this->_tpl_vars['staffmember']['name']; ?>
</option>
<?php endforeach; endif; unset($_from); ?>
</select></td></tr>
<tr><td class="fieldlabel">Status</td><td class="fieldarea"><select name="status">
<?php $_from = $this->_tpl_vars['statuses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['statusitem']):
?>
<option<?php if ($this->_tpl_vars['statusitem']['title'] == $this->_tpl_vars['status']): ?> selected<?php endif; ?> style="color:<?php echo $this->_tpl_vars['statusitem']['color']; ?>
"><?php echo $this->_tpl_vars['statusitem']['title']; ?>
</option>
<?php endforeach; endif; unset($_from); ?>
</select></td><td class="fieldlabel">Priority</td><td class="fieldarea"><select name="priority">
<option<?php if ($this->_tpl_vars['priority'] == 'High'): ?> selected<?php endif; ?>>High</option>
<option<?php if ($this->_tpl_vars['priority'] == 'Medium'): ?> selected<?php endif; ?>>Medium</option>
<option<?php if ($this->_tpl_vars['priority'] == 'Low'): ?> selected<?php endif; ?>>Low</option>
</select></td></tr>
<tr><td class="fieldlabel">CC Recipients</td><td class="fieldarea"><input type="text" name="cc" value="<?php echo $this->_tpl_vars['cc']; ?>
" size="40"> (Comma separated)</td><td class="fieldlabel">Merge Ticket</td><td class="fieldarea"><input type="text" name="mergetid" size="10"> (# to combine)</td></tr>
</table>

<img src="images/spacer.gif" height="10" width="1"><br>
<div align="center"><input type="submit" value="Save Changes" class="button"></div>
</form>

    </div>
</div>
<div id="tab4box" class="tabbox">
    <div id="tab_content">

<table cellspacing=1 bgcolor=#cccccc width=100%>
<tr style="background-color:#f2f2f2;font-weight:bold;text-align:center;"><td>Date</td><td>Action</td></tr>
<?php $_from = $this->_tpl_vars['ticketlog']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['log']):
?>
<tr bgcolor="#ffffff"><td align=center width=160><?php echo $this->_tpl_vars['log']['date']; ?>
</td><td><?php echo $this->_tpl_vars['log']['action']; ?>
</td></tr>
<?php endforeach; endif; unset($_from); ?>
</table>

    </div>
</div>

<br />

<?php if ($this->_tpl_vars['relatedproduct']): ?>
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td class="fieldlabel" width="15%">Product/Service</td><td class="fieldarea"><a href="clientshosting.php?userid=<?php echo $this->_tpl_vars['userid']; ?>
&hostingid=<?php echo $this->_tpl_vars['relatedproduct']['id']; ?>
" target="_blank"><?php echo $this->_tpl_vars['relatedproduct']['name']; ?>
</a></td><td class="fieldlabel" width="15%">Reg Date</td><td class="fieldarea"><?php echo $this->_tpl_vars['relatedproduct']['regdate']; ?>
</td></tr>
<tr><td class="fieldlabel">Domain</td><td class="fieldarea"><a href="http://<?php echo $this->_tpl_vars['relatedproduct']['domain']; ?>
" target="_blank"><?php echo $this->_tpl_vars['relatedproduct']['domain']; ?>
</a></td><td class="fieldlabel" width="15%">Next Due Date</td><td class="fieldarea"><?php echo $this->_tpl_vars['relatedproduct']['nextduedate']; ?>
</td></tr>
<tr><td class="fieldlabel">User/Pass</td><td class="fieldarea"><?php if ($this->_tpl_vars['relatedproduct']['username']): ?> <?php echo $this->_tpl_vars['relatedproduct']['username']; ?>
 / <?php echo $this->_tpl_vars['relatedproduct']['password']; ?>
 <?php echo $this->_tpl_vars['relatedproduct']['loginlink']; ?>
<?php endif; ?></td><td class="fieldlabel">Status</td><td class="fieldarea"><?php echo $this->_tpl_vars['relatedproduct']['status']; ?>
</td></tr>
</table>
<?php endif; ?>

<?php if ($this->_tpl_vars['relateddomain']): ?>
<table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr><td class="fieldlabel" width="15%">Domain</td><td class="fieldarea"><?php echo $this->_tpl_vars['relateddomain']['domain']; ?>
</td><td class="fieldlabel" width="15%">Next Due Date</td><td class="fieldarea"><?php echo $this->_tpl_vars['relateddomain']['nextduedate']; ?>
</td></tr>
<tr><td class="fieldlabel">Registrar</td><td class="fieldarea"><?php echo $this->_tpl_vars['relateddomain']['registrar']; ?>
</td><td class="fieldlabel">Registration Period</td><td class="fieldarea"><?php echo $this->_tpl_vars['relateddomain']['regperiod']; ?>
 Year(s)</td></tr>
<tr><td class="fieldlabel">Order Type</td><td class="fieldarea"><?php echo $this->_tpl_vars['relateddomain']['ordertype']; ?>
</td><td class="fieldlabel">Status</td><td class="fieldarea"><?php echo $this->_tpl_vars['relateddomain']['status']; ?>
</td></tr>
</table>
<?php endif; ?>

<br />

<table width=100% cellpadding=5 cellspacing=1 bgcolor="#cccccc" align=center>
<?php $_from = $this->_tpl_vars['replies']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['reply']):
?>
<tr bgcolor="<?php echo smarty_function_cycle(array('values' => "#F4F4F4,#F8F8F8"), $this);?>
"><td rowspan="2" width="200" valign="top">

<?php if ($this->_tpl_vars['reply']['admin']): ?>

<strong><?php echo $this->_tpl_vars['reply']['admin']; ?>
</strong><br />
Staff<br />

<?php if ($this->_tpl_vars['reply']['rating']): ?>
<br />
Rating: <?php echo $this->_tpl_vars['reply']['rating']; ?>

<br />
<?php endif; ?>

<?php else: ?>

<strong><?php echo $this->_tpl_vars['reply']['clientname']; ?>
</strong><br />

<?php if ($this->_tpl_vars['reply']['userid']): ?>
Client<br />
<?php else: ?>
<a href="mailto:<?php echo $this->_tpl_vars['reply']['clientemail']; ?>
"><?php echo $this->_tpl_vars['reply']['clientemail']; ?>
</a>
<br />
<input type="button" value="Block Sender" style="font-size:9px;" onclick="window.location='<?php echo $_SERVER['PHP_SELF']; ?>
?action=viewticket&id=<?php echo $this->_tpl_vars['ticketid']; ?>
&blocksender=true'"><br>
<?php endif; ?>

<?php endif; ?>

<?php if ($this->_tpl_vars['reply']['id']): ?>

<br />
<div class="editticketbuttons"><input type="button" value="Edit" class="editbutton" id="<?php echo $this->_tpl_vars['reply']['id']; ?>
" /></div><div class="editticketbuttons" style="display:none"><input type="button" value="Save" class="savebutton" id="<?php echo $this->_tpl_vars['reply']['id']; ?>
" >&nbsp;<input type="button" value="Cancel" class="cancelbutton" id="<?php echo $this->_tpl_vars['reply']['id']; ?>
" /></div>

<?php endif; ?>

</td><td bgcolor="#F4F4F4">

<?php if ($this->_tpl_vars['reply']['id']): ?>
<a href="#" onClick="doDeleteReply('<?php echo $this->_tpl_vars['reply']['id']; ?>
');return false">
<?php else: ?>
<a href="#" onClick="doDeleteTicket();return false">
<?php endif; ?>
<img src="images/icons/delete.png" alt="Delete Support Ticket" align="right" border="0" hspace="5"></a>

<?php if ($this->_tpl_vars['reply']['id']): ?>
<a href="#" onClick="quoteTicket('','<?php echo $this->_tpl_vars['reply']['id']; ?>
')">
<?php else: ?>
<a href="#" onClick="quoteTicket('<?php echo $this->_tpl_vars['ticketid']; ?>
','')">
<?php endif; ?>
<img src="images/icons/quote.png" align="right" border="0"></a> <?php echo $this->_tpl_vars['reply']['date']; ?>


</td></tr>
<tr><td bgcolor="#F4F4F4"<?php if ($this->_tpl_vars['reply']['id']): ?> id="<?php echo $this->_tpl_vars['reply']['id']; ?>
_box"<?php endif; ?>>

<?php echo $this->_tpl_vars['reply']['message']; ?>


<?php if ($this->_tpl_vars['reply']['numattachments']): ?>
<p>
<b>Attachments</b>
<br />
<?php $_from = $this->_tpl_vars['reply']['attachments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['attachment']):
?>
<img src="../images/article.gif"> <a href="../<?php echo $this->_tpl_vars['attachment']['dllink']; ?>
"><?php echo $this->_tpl_vars['attachment']['filename']; ?>
</a> <small><a href="<?php echo $this->_tpl_vars['attachment']['deletelink']; ?>
" style="color:#cc0000">remove</a></small><br />
<?php endforeach; endif; unset($_from); ?>
</p>
<?php endif; ?>

</td></tr>
<?php endforeach; endif; unset($_from); ?>
</table>

<p align="center"><a href="supportticketsprint.php?id=<?php echo $this->_tpl_vars['ticketid']; ?>
" target="_blank">View Printable Version</a></p>